package com.hwtx.form.persistence.ds.entity.geometry;

import lombok.Data;

@Data
public abstract class Geometry {
    public enum Type {
        Point(Point.class),
        LineString(LineString.class),
        Line(Line.class),
        LineSegment(LineSegment.class),
        Polygon(Polygon.class),
        Box(Box.class),
        Circle(Circle.class),
        MultiPoint(MultiPoint.class),
        MultiLine(MultiLine.class),
        MultiPolygon(MultiPolygon.class),
        GeometryCollection(GeometryCollection.class);

        Type(Class clazz) {
        }
    }

    protected String tag;
    protected Integer srid = 0;
    protected Integer type = 0;
    protected Byte endian = 1;
    protected Object origin;

    public String tag() {
        if (null == tag) {
            return this.getClass().getSimpleName();
        }
        return tag;
    }

    public void tag(String tag) {
        this.tag = tag;
    }

    public abstract String toString();

    public abstract String toString(boolean tag);

    public abstract String sql(boolean tag, boolean bracket);

    public abstract String sql();
}